//---------------------------------------------------------------------------- // File: ComTypes.h -- Common Types // Type: Global Definitions. // Author: Ken Anderson // Date: 12/16/05 // // OS dependant: N/A // Updates: // 5/15/4 -- Init. // 12/16/05 -- FUNCFAIL remmed out to prevent problems. // // Notes: Contains commonly used data types and structures. //---------------------------------------------------------------------------- //------------Boolean---------------// #define True 1 #define False 0 //-----------System Bits------------// typedef unsigned int local; //----Memory Types definitions----// typedef unsigned char Bool; //8-Bit typedef unsigned char Byte; //8-Bit typedef unsigned short Word; //16-Bit typedef unsigned long Dword; //32-Bit typedef signed char SByte; //Signed byte. typedef signed short SWord; typedef signed long SDword; //----Unsigned types---------------// typedef unsigned char uchar; typedef unsigned int uint; typedef unsigned short ushort; typedef unsigned long ulong; //----Pointers to Memory Types-----// typedef Byte* PByte; typedef Word* PWord; typedef Dword* PDword; typedef struct Qword { Dword HiDword; Dword LoDword; } Qword; //////////////////////////// // Rect Structures // //////////////////////////// //The common four point structure. typedef struct tg_RECTANGLE { long x; //left long y; //top long x2; //right long y2; //bottom } Rect, *PRect; //Common four point floating structure. typedef struct tg_FLOAT_RECTANGLE { float x; float y; float x2; float y2; } FRect, *PFRect; //Common four point structure composed of Dword elements. typedef struct tg_DWORD_RECTANGLE { Dword x; Dword x2; Dword x3; Dword x4; } DRect, *PDRect; //UNiversal CHAR protects the user and unsures they //will be using unicode or ansi depending on the system. #ifdef CHAR_UNICODE typedef Word unchar; #else typedef char unchar; #endif //string protects the user and ensures they //will be using unicode or ansi depending on the system. #ifdef STRING_UNICODE typedef Word* cstr; #else typedef char* cstr; #endif //----Error Code Data Type-----// typedef Dword ECTYPE; //Returns true(1) if the error code is okay(ERROR_CODE_OK); #define SUCCESS(Error) ((ECTYPE)(Error) == 0) //Returns true(1) if the error code is valid(ERROR_CODE_*); #define FAIL(Error) ((ECTYPE)(Error) > 0) //Forces the function to return if it generates a valid error. //Updated: 12/16/05 -- Function remmed out to prevent possible problems //with memory leaks. The macro forces execution out of the current //function's scope; therefore, not allowing proper clean up of any //allocated memory. //#define FUNCFAIL(Error) if((ECTYPE)(Error) > 0) {return Error;} //----COMMON ERROR CODES--------// #define EC_OK 0x00000000 //Successful operation. #define ECERR_OUTOFMEM 0x00000001 //Out of Memory operation. #define ECERR_OUTOFMEMV 0x00000002 //Out of Memory for the video operation. #define ECERR_OUTOFRNG 0x00000003 //Parameter is out of Range. #define ECERR_NULL 0x00000004 //Parameter is null. #define ECERR_INVALID 0x00000005 //Parameter was invalid. #define ECERR_NSOK 0x00000006 //The feature is not supported but was performed. #define ECERR_NA 0x00000007 //Feature or function not supported. #define ECERR_EMPTY 0x00000008 //Object is empty. #define ECERR_NULLOBJ 0x00000009 //Object was null. #define ECERR_NACREATE 0x0000000A //Creation or initialization of the object was not performed. #define ECERR_PATHNOTFOUND 0x0000000B //Path for the file's location was not found. #define ECERR_FILENOTFOUND 0x0000000C //File for the operation was not found. #define ECERR_LOCKED 0x0000000D //Buffer is locked, it needs to be unlocked before accessing. #define ECERR_RESERVED2 0x0000000E #define ECERR_RESERVED3 0x0000000F #define ECERR_UNKNOWN 0x000000FF #define ECERR_BASECOUNT 0x00000010